#./sheyang/dh2zt/Makefile
SOURCES = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES)))
OBJSD = $(addprefix $(TMP_DIR)dh2zt/,$(OBJS))

INCLUDE = -I $(PWD)/thirdparty/libuv/include \
		  -I $(PWD)/common/utilc \
		  -I $(PWD)/common/util \
		  -I $(PWD)/common/ludb \
		  -I $(PWD)/modules/mqclient \
		  -I ../accessevent

STATIC_LIB = -L $(OUT_DIR) \
             -l:accessevent.a \
			 -l:mqclient.a \
             -l:ludb.a \
			 -l:uvlogplus.a \
			 -l:util.a \
			 -l:uvlogplus.a \
			 -l:utilc.a \
			 -l:libuv.a \
			 -l:hiredis.a \
			 -l:lua.a \
			 -l:cjson.a \
			 -l:pugixml.a \
			 -l:libmariadb.a \
			 -l:ocilib.a \
			 -l:librabbitmq.a \
			 -l:zlib.a \
			 -lrt -lresolv -lssl -lcrypto -lpthread -ldl

SHARED_LIB = -L $(OUT_DIR) \
             -l:libuv.so \
			 -l:exosip.so \
			 -l:hiredis.so \
			 -l:lua.so \
			 -l:cjson.so \
			 -l:pugixml.so \
			 -l:util.so \
			 -l:utilc.so \
			 -l:ludb.so \
			 -l:uvipc.so \
			 -l:uvlogplus.so \
			 -lrt -lresolv -lssl -lcrypto -lpthread -ldl

all:chkdir dh2zt$(TAGTYPE)

chkdir:
	$(shell mkdir -p $(TMP_DIR)dh2zt/)

dh2zt_static:$(OBJS)
	$(GG) $(OBJSD) -o $(OUT_DIR)dh2zt $(STATIC_LIB)

dh2zt_shared:$(OBJS)
	$(GG) $(OBJSD) -o $(OUT_DIR)dh2zt $(SHARED_LIB)

$(OBJS):%.o:%.cpp
	$(GG) $(INCLUDE) $(GFLAGS) -c $< -o $(TMP_DIR)dh2zt/$@

clean:
	rm -rf $(TMP_DIR)dh2zt/*.o